<?php

namespace Xin\HttpClient;

use Throwable;

class RequestException extends HttpClientException
{
	/**
	 * @var HttpClient
	 */
	protected $client;

	/**
	 * @var array
	 */
	protected $requestOptions;

	/**
	 * @param string $message
	 * @param int $code
	 * @param Throwable|null $previous
	 */
	public function __construct(string $message = "", int $code = 0, Throwable $previous = null)
	{
		parent::__construct($message, $code, $previous);
	}

	/**
	 * @param HttpClient $client
	 * @return $this
	 */
	public function setClient(HttpClient $client)
	{
		$this->client = $client;
		return $this;
	}

	/**
	 * @return HttpClient
	 */
	public function getClient()
	{
		return $this->client;
	}

	/**
	 * @param array $requestOptions
	 * @return $this
	 */
	public function setRequestOptions(array $requestOptions)
	{
		$this->requestOptions = $requestOptions;
		return $this;
	}

	/**
	 * @return array
	 */
	public function getRequestOptions()
	{
		return $this->requestOptions;
	}
}
